package com.lsy.seckill.config;
import com.lsy.seckill.pojo.User;
//每个线程都有自己的ThreadLocal, 把共享数据存放到这里，保证线程安全
public class UserContext {
    private static ThreadLocal<User> threadLocal=new ThreadLocal();
    public static void setUser(User user){
        threadLocal.set(user);
    }
    public static User getUser(){
        return threadLocal.get();
    }
}
